<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateContentAuditsTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('content_audits', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('content_id')->unsigned()->nullable(false)->index()->comment("内容ID");
            $table->string('content_model', 50)->nullable(false)->index()->comment("内容模型类型");
            $table->string('audit_type', 30)->nullable(false)->index()->comment("审核类型:online,moderate,publish");
            $table->integer('userid')->unsigned(true)->nullable(false)->comment("审核申请人ID");
            $table->integer('audit1_status')->unsigned(true)->nullable(true)->comment("一级审核状态 0 不通过 1 通过");
            $table->integer('audit1_userid')->unsigned(true)->nullable(true)->comment("一级审核人ID");
            $table->timestamp('audit1_time')->nullable(true)->comment("一级审核时间");
            $table->text('audit1_text')->nullable(true)->comment("二级审核备注");
            $table->integer('audit2_status')->unsigned(true)->nullable(true)->comment("二级审核状态 0 不通过 1 通过");
            $table->integer('audit2_userid')->unsigned(true)->nullable(true)->comment("二级审核人ID");
            $table->timestamp('audit2_time')->nullable(true)->comment("二级审核时间");
            $table->text('audit2_text')->nullable(true)->comment("二级审核备注");
            $table->integer('audit3_status')->unsigned(true)->nullable(true)->comment("三级审核状态 0 不通过 1 通过");
            $table->integer('audit3_userid')->unsigned(true)->nullable(true)->comment("三级审核人ID");
            $table->timestamp('audit3_time')->nullable(true)->comment("三级审核时间");
            $table->text('audit3_text')->nullable(true)->comment("三级审核备注");
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('content_audits');
    }
}
